package com.parenting.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.parenting.entities.PlatformUserDO;
import com.parenting.mapper.PlatformUserMapper;
import com.parenting.model.PlatformUserDTO;
import com.parenting.service.PlatformUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 平台用户表 服务实现类
 * </p>
 *
 * @author 烟台业达-王世玺
 * @since 2021-10-12
 */
@Service
public class PlatformUserServiceImpl extends ServiceImpl<PlatformUserMapper, PlatformUserDO> implements PlatformUserService {

    @Override
    public PlatformUserDTO getPlatformUserDtoByPlatformUserAccount(String account) {
        PlatformUserDO platformUserDO = baseMapper.selectOne(new LambdaQueryWrapper<PlatformUserDO>().eq(PlatformUserDO::getPlatformUserAccount, account));
        if (null!=platformUserDO){
            return BeanUtil.copyProperties(platformUserDO,PlatformUserDTO.class);
        }
        return null;
    }
}
